home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple II Magazines (PO)
/
Bits and Bytes Volume 11, No. 05 (1989-11)(Apple Computing Enjoyment Society)(Side B).zip
/
Bits and Bytes Volume 11, No. 05 (1989-11)(Apple Computing Enjoyment Society)(Side B).po
/
PROGRAMS
/
LIFE.DOCS.txt
< prev
next >
Wrap
Text File
|
1996-12-24
|
8KB
|
216 lines
TULiP-The Ultimate Life Program
by
Mat Hostetter
General Description:
This program allows the user to design a pattern of "cells"
on the screen and watch it evolve according to a set of
predefined rules. The fate of each cell depends on how many
neighbors it has; some will die of loneliness, and others will
die of overpopulation. Under the right conditions, new cells are
born.
While there is a nearly infinite number of sets of rules
possible, only one has achieved lasting fame; the game of Life.
First invented in 1968 by John Horton Conway, the game of Life
has received much attention from computer scientists and
biologists alike for the insight it provides. Although Life has
proven to be a useful tool, it's rules are simple. To paraphrase
Martin Gardner:
"(1) Survivals. Every live cell with two or three
neighboring live cells survives to the next generation.
(2) Deaths. Each cell with 4 or more neighbors dies from
overpopulation. Every live cell with one neighbor or
none dies from isolation.
(3) Births. Each dead cell adjacent to exactly three
live neighbors-no more,no fewer-will be alive at the
start of the next generation."
Another way of thinking about it is:
(1) If any cell has exactly two live neighbors, it will
remain in the same state (either alive or dead.)
(2) If any cell has exactly three live neighbors, it will
come to life no matter what state it was in before.
(3) If any cell has any other number of live neighbors it
dies.
It is important to realize that all of these changes occur
simultaneously; that is, at each tick of an imaginary clock all
of the cells change states instantly.
From these simple rules we get a huge number of possible
patterns. I urge you to punch in a random pattern and let it
run. Particularly interesting (for its size) is the R pentomino:
*
**
**
Of course, this pattern (and all others) will evolve exactly the
same no matter which way you rotate them, except that it will
evolve in a different direction.
Here's another interesting one:
**
**
*
This is called the "glider" and it moves over and up once every
four "ticks", gliding endlessly along a diagonal path.
Using the Program
1. The Editor. What you will now see is a low-resolution
graphics screen with a red border.
The cursor: The flashing square in the middle of the screen is
the cursor. You can move it around with the I,J,K,M keys or with
the four arrow keys.
Drawing: To draw a dot, simply press the space bar. To erase a
live dot, position the cursor over the dot and press the space
bar.
Help: Press "H" or "?" to view the online help screen.
Colors: To switch colors, press the first letter of the color you
want to use...in other words, to draw in orange you would press
"O", to draw in violet you would press "V" etc. The five
available colors are displayed at the bottom of the screen. The
< > around a color (initially white) indicates that that color
is the current drawing color.
The Effect of Colors: Whenever a new dot is formed, its color
depends on the relative mix of colors that created it. For
example, if a new dot was formed from 2 white dots and 1 green
dot, the new dot would be white. If there is a tie (e.g. 1 white
dot,1 green dot and 1 yellow dot) the new dot will be a gray
"neutral" color. Live dots can also change colors; if a live dot
is surrounded by dots of more than one color, it will change
color if some color other than its own has the majority of the
cells surrounding it. For example, if a green dot is surrounded
by two yellow dots and one violet dot, it will become yellow. If
it is surrounded by one green, one yellow and one orange, it will
stay green (not turn neutral.) The only time a live dot will
become neutral is if there is a tie of other colors around it and
the parent color is not represented at least equally.
Evolving Your Pattern: Press return to start; if you wish to
stop, press any key. To only evolve one generation, press "E"
when you are in the editor.
Blanking the Screen: Press "B" to completely erase the screen.
THIS WILL WIPE OUT YOUR PATTERN!
Quitting: Press escape to quit the program. This will most
likely dump you into ProDOS (I followed Apple's protocol.) To
get back to BASIC just press return for the prefix and
"BASIC.SYSTEM" for the next application. Sorry, I have no
control over this one.
Editing the Rules: Press "R" to edit the rules. See below for
detailed information.
Moving the screen: Pressing control-W, control-A, control-S or
control-Z will scroll the entire screen up,left,right or down
depending on which key you press. Try it!
Disk access: press "L" to load or "S" to save. You will be
prompted for the filename. Only letters, numbers and the "." key
are allowed in filenames. No spaces are allowed in ProDOS.
Sorry, there is no inherent way to catalog from within this
program.
3. The Rules Editor
Press "R" from the main editor to get here. You will be
confronted with a text screen that lists out what will happen to
a cell if it has x neighbors. For example, when you first get
here, you will see:
0 neighbors:dead
1 neighbor :dead
2 neighbors:stay the same
3 neighbors:alive
4 neighbors:dead
5 neighbors:dead
6 neighbors:dead
7 neighbors:dead
8 neighbors:dead
This means that if a cell has exactly four live neighbors, it
will die. To change this, hit the down arrow or return several
times (or just hit "4") to position the > marker at 4 neighbors.
Now you can hit the right or left arrows to flip through the
three possible outcomes or press a,d or s. Try them all; you
can't hurt anything. Try setting 4 neighbors to "alive" by
pressing "a". Now press escape to get back to the main editor
and try a pattern. It will evolve differently!
Press "R" to return to the rules editor if you aren't there
already and press "T". This changes the type of neighborhood
each cell is in. If the screen says
"Type of neighborhood:ignore diagonals"
then the program will not figure in diagonally adjacent squares
when it processes each dot. Incidentally, if you include
diagonals you are using the "Moore neighborhood." If you choose
to ignore them, you are using the "von Neuman neighborhood."
They each behave radically differently.
You may also try setting the "middle dot treatment" to "count
center dot." This can have interesting effects...
For an experiment, set everything to "dead" except for "1
neighbor." Now set the Type of neighborhood to "ignore
diagonals" by pressing "T" (if you have to.) Now press escape to
exit back to the main editor. Now, blank the screen and place a
single dot in the center. Press Return to run it. Neat! Try
some multi-dot, multi-color patterns with these rules.
You will notice as you experiment that some sets of rules are too
forgiving and the screen rapidly fills up with dots. Others are
too harsh and kill everything off quickly.
Any pattern that attempts to create a new dot on the border will
fail to do so. Once a pattern attempts to create a dot where no
dot can ever form it is not following the "pure" rules. If you
notice your pattern evolving near the edge of the screen, you can
return to the editor by pressing a key, and then use ctrl-A,
ctrl-W, ctrl-S or ctrl-Z as detailed above to move the pattern
away from the edge.
Above all, experiment! Some really weird stuff can happen. Some
would consider some of the evolving patterns a kind of "dynamic
art"--be an artist!
If you have any questions or comments, feel free to leave me a
message:
AppleLink P.E. Air Hoople
CompuServe 74736,2307
This program is shareware. If you get a kick out of it, please
send $10 to me (a-soon-to-be-starving-college-student) so I can
continue to write unusual stuff (and eat,too!)
Mat Hostetter
3921 Chelmsford
Topeka,KS 66610
Thanks!